define(['jquery', 'bootstrap', 'backend', 'table', 'form','editable'], function ($, undefined, Backend, Table, Form, undefined) {
    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/index' + location.search,
                    add_url: 'project_2020_bak/add',
                    edit_url: 'project_2020_bak/edit',
                    del_url: 'project_2020_bak/del',
                    multi_url: 'project_2020_bak/multi',
                    table: 'project_2020_bak',
                },
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'pno', title: __('Pno')},
                        // {field: 'sort', title: __('Sort')},
                        // {field: 'street_id', title: __('Street_id')},
                        {field: 'street_name', title: __('Street_name')},
                        {field: 'name', title: __('Name')},
                        {field: 'investment_total', title: __('Investment_total'), operate:'BETWEEN'},
                        {field: 'progression', title: __('Progression')},
                        {field: 'problem', title: __('Problem')},
                        {field: 'next_measure', title: __('Next_measure')},
                        {field: 'access_time', title: __('Access_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'access_time_desc', title: __('Access_time_desc')},
                        {field: 'sign_time', title: __('Sign_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'sign_time_desc', title: __('Sign_time_desc')},
                        {field: 'framework_agreement_time', title: __('Framework_agreement_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'framework_agreement_time_desc', title: __('Framework_agreement_time_desc')},
                        {field: 'invesment_agreement_time', title: __('Invesment_agreement_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'invesment_agreement_time_desc', title: __('Invesment_agreement_time_desc')},
                        {field: 'start_construction_time', title: __('Start_construction_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'start_construction_time_desc', title: __('Start_construction_time_desc')},
                        {field: 'register_time', title: __('Register_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'register_time_desc', title: __('Register_time_desc')},
                        {field: 'investment_area', title: __('Investment_area')},
                        {field: 'investment_name', title: __('Investment_name')},
                        {field: 'investment_is_listed', title: __('Investment_is_listed')},
                        {field: 'investment_is_soe', title: __('Investment_is_soe')},
                        {field: 'investment_is_soke', title: __('Investment_is_soke')},
                        {field: 'investment_is_global500', title: __('Investment_is_global500')},
                        {field: 'investment_is_china500', title: __('Investment_is_china500')},
                        {field: 'asset_type', title: __('Asset_type')},
                        {field: 'accountability_unit', title: __('Accountability_unit')},
                        {field: 'planned_street', title: __('Planned_street')},
                        {field: 'project_source_id', title: __('Project_source_id')},
                        {field: 'project_source_name', title: __('Project_source_name')},
                        {field: 'project_contact_mobile', title: __('Project_contact_mobile')},
                        {field: 'project_contact_nickname', title: __('Project_contact_nickname')},
                        {field: 'city_district_contact_mobile', title: __('City_district_contact_mobile')},
                        {field: 'progress_status_name', title: __('Progress_status')},
                        {field: 'five_industry_id', title: __('Five_industry_id')},
                        {field: 'five_industry_name', title: __('Five_industry_name')},
                        {field: 'industry_category_ids', title: __('Industry_category_ids')},
                        {field: 'industry_category_name', title: __('Industry_category_name')},
                        {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        discuss: function () {
            // 初始化表格参数配置
            // Table.api.init({
            //     // extend: {
            //     //     index_url: 'project/discuss' + location.search,
            //     //     add_url: 'project/discuss_add',
            //     //     edit_url: 'project/edit',
            //     //     // del_url: 'project/del',
            //     //     // multi_url: 'project/multi',
            //     //     table: 'project',
            //     // }
            // });

            Table.api.init();
            var table1 = $("#table1");

            // 初始化表格
            table1.bootstrapTable({
                extend: {
                    add_url: 'project_2020_bak/discuss_add',
                    edit_url: 'project_2020_bak/edit',
                    del_url: 'project_2020_bak/del',
                    multi_url: 'project_2020_bak/multi',
                    dragsort_url: 'ajax/weigh',
                },
                url: 'project_2020_bak/discuss' + location.search,
                pk: 'id',
                sortName: 'status desc,id desc',
                undefinedText:'',
                toolbar: "#toolbar1",
                singleSelect:true,
                // search:false,
                showToggle:false,
                showExport:false,
                //启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 4,
                // showColumns:false,
                // escape:true,
                columns: Controller.api.columns(table1,true,true,true,true),
                rowStyle:function(row,index){
                    var style = {};
                    // var classes =  ["gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];

                    if(row.is_add == 1 && Config.isSuperAdmin)
                        style={css:{'color':'#ff0000'}};
                    if(row.reject_memo_status == 1)
                        style={css:{'color':'blue'}};
                    // console.log(style);
                    return style;
                }
            });

            // 为表格绑定事件
            Table.api.bindevent(table1);
            Controller.api.bindeventTable(table1);

            var table2 = $("#table2");

            // 初始化表格
            table2.bootstrapTable({
                url: 'project_2020_bak/discuss' + location.search,
                pk: 'id',
                sortName: 'id',
                toolbar: "#toolbar2",
                queryParams:function(params){
                    // console.log(params.filter);
                    params.filter = JSON.parse(params.filter);
                    params.op = JSON.parse(params.op);
                    params.filter.status = 1;
                    params.op.status = '=';

                    params.filter = JSON.stringify(params.filter);
                    params.op = JSON.stringify(params.op);
                    return params;
                },
                columns: Controller.api.check_columns(table2),
                rowStyle:function(row,index){
                    var style = {};
                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000 '}};
                    return style;
                }
            });

            // 为表格绑定事件
            Table.api.bindevent(table2);


            var table3 = $("#table3");

            // 初始化表格
            table3.bootstrapTable({
                url: 'project_2020_bak/discuss' + location.search,
                pk: 'id',
                sortName: 'id',
                toolbar: "#toolbar3",
                queryParams:function(params){
                    // console.log(params.filter);
                    params.filter = JSON.parse(params.filter);
                    params.op = JSON.parse(params.op);
                    params.filter.is_convert = 1;
                    params.op.status = '=';

                    params.filter = JSON.stringify(params.filter);
                    params.op = JSON.stringify(params.op);
                    return params;
                },
                columns: [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        // {field: 'pno', title: __('Pno')},
                        // {field: 'sort', title: __('Sort')},
                        {field: 'name', title: __('Name')},
                        {field: 'chargedep_names', title: __('提报部门')},
                        {
                            field: 'check',
                            width: "120px",
                            title: __('审核'),
                            table: table3,
                            events: Table.api.events.operate,
                            visible: Config.isSuperAdmin ? true:false,
                            buttons: [
                                {
                                    name: 'check',
                                    text: '审核',
                                    title: __('审核'),
                                    classname: 'btn btn-xs btn-warning  btn-magic btn-ajax',
                                    icon: 'fa fa-folder-o',
                                    url: 'project_2020_bak/convert',
                                    success: function (data, ret) {
                                        // alert("ssss");
                                        $("#toolbar3 .btn-refresh").trigger("click");
                                    },
                                    error: function (data, ret) {
                                        Layer.alert(ret.msg);
                                        return false;
                                    }
                                }
                            ],
                            formatter: function (value, row, index) {
                                // console.log(Config.isSuperAdmin)
                                if(Config.isSuperAdmin){
                                    return Table.api.formatter.buttons.call(this, value, row, index);
                                }
                                return '';
                            }
                        }

                    ],
                // rowStyle:function(row,index){
                //     var style = {};
                //     if(row.is_add == 1 )
                //         style={css:{'color':'#ff0000 '}};
                //     return style;
                // }
            });

            // 为表格绑定事件
            Table.api.bindevent(table3);

            // $("#btn-import-custom").click(function () {
            //     var url = 'project/importdiscuss';
            //     var icon = 'fa fa-pencil';
            //     Backend.api.addtabs(url, '编辑', icon);
            // });
            $("#btn-import-custom").click(function () {
                if(Config.isbinddep || Config.isSuperAdmin)
                {
                    var url = 'project_2020_bak/importdiscuss';
                    Fast.api.open(url, __('Import'), {});
                } else {
                    Layer.alert(__('您还未绑定部门，请先绑定'));
                }
            });



        },
        signed: function() {
            // 初始化表格参数配置
            // Table.api.init({
            //     extend: {
            //         index_url: 'project/signed' + location.search,
            //         add_url: 'project/add',
            //         edit_url: 'project/binedit',
            //         // del_url: 'project/del',
            //         // multi_url: 'project/multi',
            //         table: 'project',
            //     }
            // });
            Table.api.init();
            var table1 = $("#table1");

            // 初始化表格
            table1.bootstrapTable({
                extend: {
                    add_url: 'project_2020_bak/signed_add',
                    edit_url: 'project_2020_bak/edit',
                    del_url: 'project_2020_bak/del',
                    multi_url: 'project_2020_bak/multi',
                    dragsort_url: 'ajax/weigh',
                },
                url: 'project_2020_bak/signed' + location.search,
                pk: 'id',
                // sortName: 'is_add desc,field(status,-1,1,0),id desc',
                undefinedText:'',
                toolbar: "#toolbar1",
                // search:false,
                showToggle:false,
                singleSelect:true,
                showExport:false,
                 // 启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 4,
                columns: Controller.api.columns(table1,true,true,true,true),
                rowStyle:function(row,index){
                    var style = {};
                    // var classes =  ["gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];

                    if(row.is_add == 1 && Config.isSuperAdmin)
                        style={css:{'color':'#ff0000'}};
                    if(row.reject_memo_status == 1)
                        style={css:{'color':'blue'}};
                    // console.log(style);
                    return style;
                }

            });

            // 为表格绑定事件
            Table.api.bindevent(table1);
            Controller.api.bindeventTable(table1);
            var table2 = $("#table2");

            // 初始化表格
            table2.bootstrapTable({
                url: 'project_2020_bak/signed' + location.search,
                pk: 'id',
                sortName: 'id',
                toolbar: "#toolbar2",
                queryParams:function(params){
                    // console.log(params);
                    params.filter = JSON.parse(params.filter);
                    params.op = JSON.parse(params.op);
                    params.filter.status = 1;
                    params.op.status = '=';
                    // params.filter.is_important = 0;
                    // params.op.is_important = '=';
                    params.filter = JSON.stringify(params.filter);
                    params.op = JSON.stringify(params.op);
                    return params;
                },
                columns: Controller.api.check_columns(table2),
                rowStyle:function(row,index){
                    var style = {};
                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000'}};
                    return style;
                }
            });

            // 为表格绑定事件
            Table.api.bindevent(table2);

            $("#btn-import-custom").click(function () {
                if(Config.isbinddep || Config.isSuperAdmin)
                {
                    var url = 'project_2020_bak/importsigned';
                    Fast.api.open(url, __('Import'), {});
                } else {
                     Layer.alert(__('您还未绑定部门，请先绑定'));
                }
            });
            // Controller.api.events.operate;
        },
        major: function() {
            // 初始化表格参数配置
            // Table.api.init({
            //     extend: {
            //         index_url: 'project/signed' + location.search,
            //         add_url: 'project/add',
            //         edit_url: 'project/binedit',
            //         // del_url: 'project/del',
            //         // multi_url: 'project/multi',
            //         table: 'project',
            //     }
            // });
            Table.api.init();
            var table1 = $("#table1");

            // 初始化表格
            table1.bootstrapTable({
                extend: {
                    add_url: 'project_2020_bak/major_add',
                    edit_url: 'project_2020_bak/edit',
                    del_url: 'project_2020_bak/del',
                    multi_url: 'project_2020_bak/multi',
                    dragsort_url: 'ajax/weigh',
                },
                url: 'project_2020_bak/major' + location.search,
                pk: 'id',
                sortName: 'status desc,id desc',
                undefinedText:'',
                toolbar: "#toolbar1",
                // search:false,
                showToggle:false,
                singleSelect:true,
                 //启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 5,
                columns: Controller.api.columns(table1,true,true,true,true),
                rowStyle:function(row,index){
                    var style = {};
                    // var classes =  ["gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];

                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000'}};
                    if(row.reject_memo_status == 1)
                        style={css:{'color':'blue'}};
                    console.log(style);
                    return style;
                }

            });

            // 为表格绑定事件
            Table.api.bindevent(table1);
            Controller.api.bindeventTable(table1);
            var table2 = $("#table2");

            // 初始化表格
            table2.bootstrapTable({
                url: 'project_2020_bak/major' + location.search,
                pk: 'id',
                sortName: 'id',
                toolbar: "#toolbar2",
                queryParams:function(params){
                    // console.log(params);
                    params.filter = JSON.parse(params.filter);
                    params.op = JSON.parse(params.op);
                    params.filter.status = 1;
                    params.op.status = '=';
                    params.filter = JSON.stringify(params.filter);
                    params.op = JSON.stringify(params.op);
                    return params;
                },
                columns: Controller.api.check_columns(table2),
                rowStyle:function(row,index){
                    var style = {};
                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000'}};
                    return style;
                }
            });

            // 为表格绑定事件
            Table.api.bindevent(table2);

            $("#btn-import-custom").click(function () {
                if(Config.isbinddep || Config.isSuperAdmin)
                {
                    var url = 'project_2020_bak/importsigned';
                    Fast.api.open(url, __('Import'), {});
                } else {
                     Layer.alert(__('您还未绑定部门，请先绑定'));
                }
            });
            // Controller.api.events.operate;
        },


        new: function() {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/new' + location.search,
                    // add_url: 'project/add',
                    // edit_url: 'project/binedit',
                    // del_url: 'project/del',
                    multi_url: 'project_2020_bak/multi',
                    table: 'project_2020_bak',
                }
            });
            Table.api.init();
            var table1 = $("#table1");

            // 初始化表格
            table1.bootstrapTable({
                extend: {
                    // add_url: 'project/major_add',
                    edit_url: 'project_2020_bak/edit',
                    // del_url: 'project_2020_bak/del',
                    multi_url: 'project_2020_bak/multi',
                    dragsort_url: 'ajax/weigh',
                },
                url: 'project_2020_bak/new' + location.search,
                pk: 'id',
                sortName: 'status desc,id desc',
                undefinedText:'',
                toolbar: "#toolbar1",
                // search:false,
                showToggle:false,
                singleSelect:true,
                showExport:false,
                showColumns: true,
                 //启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 4,
                columns: Controller.api.columns(table1,true,true,true,true),
                // rowStyle:function(row,index){
                //     var style = {};
                //     // var classes =  ["gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];
                //     if(row.land_time>0)
                //     {
                //         var timestamp = Date.parse(new Date());//当前时间
                //         var end=row.land_time*1000;//拿地时间
                //         var utc=end-timestamp;
                //         var day = utc/(24*60*60*1000);// 天
                //         console.log(day);
                //         console.log(row.land_time);
                //         if(day<10) //10天以内背景标黄
                //             style={css:{'background-color':'yellow'}};
                //         if(day<0) //10天以内背景标黄
                //             style={css:{'background-color':'red','color':"white"}};

                //     }
                //     return style;
                // }

            });


            // 为表格绑定事件
            Table.api.bindevent(table1);
            Controller.api.bindeventTable(table1);
            // var table2 = $("#table2");

            // // 初始化表格
            // table2.bootstrapTable({
            //     url: 'project/new' + location.search,
            //     pk: 'id',
            //     sortName: 'id',
            //     toolbar: "#toolbar2",
            //     queryParams:function(params){
            //         // console.log(params);
            //         params.filter = JSON.parse(params.filter);
            //         params.op = JSON.parse(params.op);
            //         params.filter.status = 1;
            //         params.op.status = '=';
            //         params.filter = JSON.stringify(params.filter);
            //         params.op = JSON.stringify(params.op);
            //         return params;
            //     },
            //     columns: Controller.api.check_columns(table2),
            //     rowStyle:function(row,index){
            //         var style = {};
            //         if(row.is_add == 1 )
            //             style={css:{'color':'#ff0000'}};
            //         return style;
            //     }
            // });

            // // 为表格绑定事件
            // Table.api.bindevent(table2);
        },


        dispatch: function () {

            Table.api.init();
            var table1 = $("#table1");

            // 初始化表格
            table1.bootstrapTable({
                extend: {
                    add_url: 'project_2020_bak/discuss_add',
                    edit_url: 'project_2020_bak/edit',
                    del_url: 'project_2020_bak/del',
                    multi_url: 'project_2020_bak/multi',
                    dragsort_url: 'ajax/weigh',
                },
                url: 'project_2020_bak/dispatch' + location.search,
                pk: 'id',
                sortName: 'status desc,id desc',
                undefinedText:'',
                toolbar: "#toolbar1",
                singleSelect:true,
                // search:false,
                showToggle:false,
                showExport:false,
                //启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 4,
                // showColumns:false,
                // escape:true,
                columns: [
                        {checkbox: true},
                        // {field: 'id', title: __('Id')},
                        // {field: 'pno', title: __('Pno')},
                        // {field: 'sort', title: __('Sort')},
                        {field: 'name', title: __('Name')},
                        {field: 'investment_total', title: __('总投资(亿元)')},
                        {field: 'settle_street_names', title: __('落户街道')},
                    ],
                // columns: Controller.api.columns(table1,true,true,true,true),
                rowStyle:function(row,index){
                    var style = {};
                    // var classes =  ["gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];

                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000'}};
                    if(row.reject_memo_status == 1)
                        style={css:{'color':'blue'}};
                    // console.log(style);
                    return style;
                }
            });

            // 为表格绑定事件
            Table.api.bindevent(table1);
            Controller.api.bindeventTable(table1);

            var table2 = $("#table2");

            // 初始化表格
            table2.bootstrapTable({
                url: 'project/discuss' + location.search,
                pk: 'id',
                sortName: 'id',
                toolbar: "#toolbar2",
                queryParams:function(params){
                    // console.log(params.filter);
                    params.filter = JSON.parse(params.filter);
                    params.op = JSON.parse(params.op);
                    params.filter.status = 1;
                    params.op.status = '=';

                    params.filter = JSON.stringify(params.filter);
                    params.op = JSON.stringify(params.op);
                    return params;
                },
                columns: Controller.api.check_columns(table2),
                rowStyle:function(row,index){
                    var style = {};
                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000 '}};
                    return style;
                }
            });

            // 为表格绑定事件
            Table.api.bindevent(table2);


            var table3 = $("#table3");

            // 初始化表格
            table3.bootstrapTable({
                url: 'project_2020_bak/discuss' + location.search,
                pk: 'id',
                sortName: 'id',
                toolbar: "#toolbar3",
                queryParams:function(params){
                    // console.log(params.filter);
                    params.filter = JSON.parse(params.filter);
                    params.op = JSON.parse(params.op);
                    params.filter.is_convert = 1;
                    params.op.status = '=';

                    params.filter = JSON.stringify(params.filter);
                    params.op = JSON.stringify(params.op);
                    return params;
                },
                columns: [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        // {field: 'pno', title: __('Pno')},
                        // {field: 'sort', title: __('Sort')},
                        {field: 'name', title: __('Name')},
                        {field: 'chargedep_names', title: __('提报部门')},
                        {
                            field: 'check',
                            width: "120px",
                            title: __('审核'),
                            table: table3,
                            events: Table.api.events.operate,
                            visible: Config.isSuperAdmin ? true:false,
                            buttons: [
                                {
                                    name: 'check',
                                    text: '审核',
                                    title: __('审核'),
                                    classname: 'btn btn-xs btn-warning  btn-magic btn-ajax',
                                    icon: 'fa fa-folder-o',
                                    url: 'project_2020_bak/convert',
                                    success: function (data, ret) {
                                        // alert("ssss");
                                        $("#toolbar3 .btn-refresh").trigger("click");
                                    },
                                    error: function (data, ret) {
                                        Layer.alert(ret.msg);
                                        return false;
                                    }
                                }
                            ],
                            formatter: function (value, row, index) {
                                // console.log(Config.isSuperAdmin)
                                if(Config.isSuperAdmin){
                                    return Table.api.formatter.buttons.call(this, value, row, index);
                                }
                                return '';
                            }
                        }

                    ],
                // rowStyle:function(row,index){
                //     var style = {};
                //     if(row.is_add == 1 )
                //         style={css:{'color':'#ff0000 '}};
                //     return style;
                // }
            });

            // 为表格绑定事件
            Table.api.bindevent(table3);

            // $("#btn-import-custom").click(function () {
            //     var url = 'project/importdiscuss';
            //     var icon = 'fa fa-pencil';
            //     Backend.api.addtabs(url, '编辑', icon);
            // });
            $("#btn-import-custom").click(function () {
                if(Config.isbinddep || Config.isSuperAdmin)
                {
                    var url = 'project_2020_bak/importdiscuss';
                    Fast.api.open(url, __('Import'), {});
                } else {
                    Layer.alert(__('您还未绑定部门，请先绑定'));
                }
            });
        },


        approach: function() {
            // 初始化表格参数配置
            // Table.api.init({
            //     extend: {
            //         index_url: 'project/signed' + location.search,
            //         add_url: 'project/add',
            //         edit_url: 'project/binedit',
            //         // del_url: 'project/del',
            //         // multi_url: 'project/multi',
            //         table: 'project',
            //     }
            // });
            Table.api.init();
            var table1 = $("#table1");

            // 初始化表格
            table1.bootstrapTable({
                extend: {
                },
                url: 'project_2020_bak/approach' + location.search,
                pk: 'id',
                sortName: 'status desc,id desc',
                undefinedText:'',
                toolbar: "#toolbar1",
                // search:false,
                showToggle:false,
                singleSelect:true,
                 //启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 5,
                columns: [
                    [
                        {checkbox: true,width:'10px',},
                        {field: '', title: __('序号'),operate:false,table: table1,width:'20px',formatter:Table.api.formatter.natureorder},
                        {field: 'name', title: __('Name'),operate:'like',width:'120px'},
                        {field: 'library_name', title: __('所在库'),operate:false,width:'120px'},
                        {field: 'chargedep_names', title: __('提报部门'),width:'80px',operate:false,
                            formatter:Table.api.formatter.delimiter
                        },
                        {field: 'chargedep_ids', title: __('提报部门'),visible:false,
                                    operate:'FIND_IN_SET',
                                    searchList: $.getJSON("selectlist/index/tablename/chargedep")
                                    // extend:"data-source='chargedep/index'"
                        },
                        {field: 'five_industry_id', title: __('Five_industry_id'),
                            width:'120px',
                            visible:false,
                            searchList: $.getJSON("selectlist/index/tablename/five_industry")
                            // extend:"data-source='five_industry/index'"
                        },
                        {field: 'industry_category_ids', title: __('Industry_category_ids'),
                            visible:false,
                            operate:'FIND_IN_SET',
                            searchList: $.getJSON("selectlist/index/tablename/industry_category")
                            // extend:"data-source='industry_category/index'"
                        },
                        {field: 'industry_category_names', width:'80px',title: __('industry_category_ids'),
                            operate:false,
                            formatter:function(value,row,index){
                                if(value)
                                {
                                    str = value.replace(/都不是/g,"");
                                    str = str.replace(/,/g,"/");
                                    str = str?'/'+str:str;
                                    return row.five_industry_name + str;
                                }
                                else
                                    return row.five_industry_name;

                            }
                        },
                        {field: 'investment_total', title: __('Investment_total'),
                            width:'50px',
                            operate:'BETWEEN',
                            formatter:function(value,row,index) {
                                if(value == -100)
                                    return '待定';
                                else if(value > 0)
                                    return parseFloat(value);
                                else
                                    return '';
                            }
                        },
                        {field: 'domestic_capital', title: __('Domestic_capital'),
                            width:'50px',
                            operate:'BETWEEN',
                            formatter:function(value,row,index) {
                                if(value == -100)
                                    return '待定';
                                else if(value > 0)
                                    return parseFloat(value);
                                else
                                    return '';
                            }
                        },
                        {field: 'foreign_capital', title: __('Foreign_capital'),
                            width:'50px',
                            operate:'BETWEEN',
                            formatter:function(value,row,index) {
                                if(value == -100)
                                    return '待定';
                                else if(value > 0)
                                    return parseFloat(value);
                                else
                                    return '';
                            }
                        },
                        {field: 'access_time', title: __('access_time'),
                            addclass:'datetimerange',
                            visible:false
                        },
                        {field: 'access_time_desc', title: __('access_time'),
                            width:'80px',
                            operate:false,
                        },
                        {field: 'sign_time', title: __('sign_time'),
                            addclass:'datetimerange',
                            visible:false
                        },
                        {field: 'sign_time_desc', title: __('sign_time'),
                            width:'80px',
                            operate:false,
                        },
                        {field: 'framework_agreement_time_desc', title: __('framework_agreement_time_desc'),
                            width:'80px',
                            operate:false
                        },
                        {field: 'framework_agreement_time', title: __('framework_agreement_time_desc'),
                            visible:false,
                            addclass:'datetimerange',
                            operate: 'RANGE',
                            datetimeFormat:"YYYY-MM-DD",
                        },
                        {field: 'invesment_agreement_time_desc',
                            width:'80px',
                            title: __('invesment_agreement_time_desc'),
                            operate:false
                        },
                        {field: 'invesment_agreement_time', title: __('invesment_agreement_time'),
                            visible:false,
                            addclass:'datetimerange',
                            operate: 'RANGE',
                            datetimeFormat:"YYYY-MM",
                        },
                        {field: 'register_time', title: __('register_time'),
                            addclass:'datetimerange',
                            datetimeFormat:"YYYY-MM",
                            operate: 'RANGE',
                            formatter: Table.api.formatter.datetime,
                            visible:false
                        },
                        {field: 'register_time_desc', title: __('register_time'),
                            width:'80px',
                            operate:false
                        },
                        {field: 'land_time', title: __('land_time'),
                            addclass:'datetimerange',
                            datetimeFormat:"YYYY-MM",
                            operate: 'RANGE',
                            formatter: Table.api.formatter.datetime,
                            visible:false
                        },
                        {field: 'land_time_desc', title: __('land_time'),
                            width:'80px',
                            operate:false
                        },
                        {field: 'start_construction_time', title: __('start_construction_time'),
                            addclass:'datetimerange',
                            operate: 'RANGE',
                            datetimeFormat:"YYYY-MM",
                            formatter: Table.api.formatter.datetime,
                            visible:false
                        },
                        {field: 'start_construction_time_desc', title: __('start_construction_time'),
                            width:'80px',
                            operate:false
                        },
                        {field: 'investment_name',title: __('investment_name'),width:'100px',operate:'like',
                            formatter:Table.api.formatter.delimiter
                        },
                        {field: 'investment_area', title: __('investment_area'),operate:'like',
                            width:'60px',
                            formatter:Table.api.formatter.delimiter
                        },
                        {field: 'investment_attribute_ids', title: __('Investment_attribute_ids'),
                            visible:false,
                            operate:'FIND_IN_SET',
                            searchList: $.getJSON("selectlist/index/tablename/investor_attribute")
                        },
                        {field: 'investment_attribute_names', title: __('Investment_attribute_ids'),
                            width:'80px',
                            operate:'like',
                            operate:false,formatter:Table.api.formatter.delimiter
                        },

                        {field: 'carrier_id', title: __('Carrier_id'),
                            visible:false,
                            operate:'FIND_IN_SET',
                            searchList: $.getJSON("selectlist/index/tablename/carrier")
                        },
                        {field: 'carrier_name', title: __('Carrier_id'),
                            width:'80px',
                            operate:'like',
                            operate:false,formatter:Table.api.formatter.delimiter
                        },


                        {field: 'project_source_ids', title: __('project_source_ids'),
                            visible:false,
                            operate:'FIND_IN_SET',
                            searchList: $.getJSON("selectlist/index/tablename/activity")
                        },
                        {field: 'project_source_names', title: __('project_source_ids'),
                            width:'80px',
                            operate:false,
                            formatter:Table.api.formatter.delimiter
                        },
                        {field: 'summary', title: __('Summary'),width:"100px",operate:false,
                            formatter: function(value,row,index) {
                                var str = value?value:'';
                                return '<div style="width:100px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">'+str+'</div>';
                            }
                        },
                        {field: 'city_district_contact', title: __('City_district_contact'),width:"60px",operate:false}
                    ]
                ],
                rowStyle:function(row,index){
                    var style = {};
                    // var classes =  ["gray", "red", "yellow", "aqua", "blue", "navy", "teal", "olive", "lime", "fuchsia", "purple", "maroon"];

                    if(row.is_add == 1 )
                        style={css:{'color':'#ff0000'}};
                    if(row.reject_memo_status == 1)
                        style={css:{'color':'blue'}};
                    console.log(style);
                    return style;
                }

            });

            // 为表格绑定事件
            Table.api.bindevent(table1);
            Controller.api.bindeventTable(table1);



            // Controller.api.events.operate;
        },
        bymonth: function() {
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/bymonth' + location.search,
                    // add_url: 'project/add',
                    // edit_url: 'project/edit',
                    // del_url: 'project/del',
                    // multi_url: 'project/multi',
                    table: 'project',
                }
            });

            var table = $("#table");
            // console.log('project/leader' + location.search);
            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: Controller.api.columns(table,3)
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },

        activity: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/activity' + location.search,
                    table: 'project_2020_bak',
                }
            });

            var table = $("#table");


            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                undefinedText:'',
                // search:false,
                showToggle:false,
                singleSelect:true,
                queryParams:function(params){
                    $.extend(params, {
                        ids: Config.ids
                    });
                    return params;
                },
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 4,
                // columns: Controller.api.columns(table1,true,true),
                columns: Controller.api.columns(table,false,false,false,false)

            });

            // 为表格绑定事件
            Table.api.bindevent(table);
            Controller.api.bindeventTable(table);

        },
        province: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/province' + location.search,
                    table: 'project_2020_bak',
                }
            });

            var table = $("#table");


            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: Controller.api.columns(table,false,false)

            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        city: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/city' + location.search,
                    table: 'project_2020_bak',
                }
            });

            var table = $("#table");


            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',

                columns: Controller.api.columns(table,false,false)

            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        access: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'project_2020_bak/access' + location.search,
                    table: 'project_2020_bak',
                }
            });

            var table = $("#table");


            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                undefinedText:'',
                showColumns: false,
                showToggle: false,
                showExport: false,
                showSearch: true,
                commonSearch: true,
                search: false,
                 // 启用固定列
                fixedColumns: true,
                //固定右侧列数
                fixedNumber: 4,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('序号'),table: table,width:'20px',formatter:Table.api.formatter.natureorder},
                        // {field: '', title: __('序号'),operate:false,table: table,formatter:Table.api.formatter.natureorder},
                        {field: 'name', title: __('Name'),operate:'like',width:'160px'},
                        {field: 'investment_name', title: __('投资方'),operate:'like',width:'160px'},
                        {field: 'investment_total', title: __('总投资(亿元)'), width:'60px',operate:'BETWEEN',
                            formatter:function(value,row,index) {
                                if(value == -100)
                                    return '待定';
                                else
                                    return value;
                            }
                        },
                        {field: 'carrier_area', title: __('Carrier_area'),width:'80px',operate:false},
                        {field: 'summary', title: __('项目内容'), width: '260px',operate:false,
                            formatter:function(value,row,index){
                                if(row.summary&&row.summary.length<=35){
                                    return+row.summary;
                                }
                                if(row.summary&&row.summary.length>35){
                                  return row.summary.substring(0,34)+"...";
                                }
                            }
                        },
                        // 为了衬托样式的宽度，随便加的ID，用到之后直接删除
                        {field: '', title: __('参加准入例会时间'),width:'120px',operate:false,},

                        {field: '', title: __('项目状态'),width:'100px',operate:false},

                        {field: '', title: __('存在问题'),width:'100px',operate:false},

                        {field: '', title: __('税收约定及纳税情况说明'),width:'100px',operate:false},



                        // {field: 'admission_meeting_time_desc', title: __('参加准入例会时间'), operate:false},
                        // {field: 'special_meeting_time_desc', title: __('参加区委专题会时间'), operate:false},
                        // {field: 'progress_status_id', title: __('项目阶段'),
                        //     visible:false,
                        //     searchList: $.getJSON("selectlist/progress")
                        // },
                        // {field: 'progress_status_name', title: __('progress_status_name'),width:'80px',
                        //     operate:false,
                        // },
                        // {field: 'problem', title: __('Problem'),operate:false},
                        // {field: 'tax_desc', title: __('税收约定及纳税情况说明'), operate:false},

                        {field: 'chargedep_names', title: __('责任单位'),operate:false,width:'90px'},
                        {field: 'chargedep_ids', title: __('责任单位'),visible:false,
                                    operate:'FIND_IN_SET',
                                    searchList: $.getJSON("selectlist/index/tablename/chargedep")
                                    // extend:"data-source='chargedep/index'"
                        },
                        // {field: 'settle_street_names', title: __('落户街道'),operate:false,width:'80px',
                        //     formatter:function(value,row,index){
                        //         if(row.library_id == 1)
                        //             return row.planned_street_names;
                        //         if(row.library_id == 2)
                        //             return row.settle_street_names;
                        //     }
                        // },
                        // {field: 'settle_street_ids', title: __('落户街道'),visible:false,
                        //             operate:'FIND_IN_SET',
                        //             searchList: $.getJSON("selectlist/index/tablename/chargedep")
                        //             // extend:"data-source='chargedep/index'"
                        // },
                        {field: 'operate', title: __('Operate'), width:'60px', align:'center',table: table, events: Table.api.events.operate,
                            buttons: [
                               {
                                    name: 'detail',
                                    icon: 'fa fa-info',
                                    title: __('详情'),
                                    text: '详情',
                                    url: 'project/detail',
                                    extend: 'data-toggle="tooltip"',
                                    classname: 'btn btn-xs btn-info btn-addtabs'
                                }
                            ],
                            formatter: Table.api.formatter.buttons

                        },



                    ]
                ]

            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        importdiscuss:function() {
            Controller.api.bindevent();
        },
        importsigned:function() {
            Controller.api.bindevent();
        },
        add: function () {
            Controller.api.bindevent();

        },
        edit: function () {
            Controller.api.bindevent();
            // Controller.api.custom_bindvent($("form[role=plan-form]"));
            Controller.api.custom_bindvent($("form[role=capital-form]"));
            // Controller.api.custom_bindvent($("form[role=formalities-form]"));

            $(".single_submit").click(function(event) {
                Controller.api.bindSubmitSingle(this, 1);
            });

            $(".single_draft").click(function(event) {
               Controller.api.bindSubmitSingle(this, 0);
            });

            $(".all_submit").click(function(event) {
                Controller.api.bindSubmitAll(1);
            })

            $(".all_draft").click(function(event) {
                Controller.api.bindSubmitAll(0);
            })
            $(".single_revoke_reject").click(function(event) {
                var that = this;
                var item_id = $(that).data("item_id");
                var data = {};
                data['item_id'] = item_id;
                Layer.confirm(__('确定要撤消驳回吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "project/checkrevokereject/ids/"+ Config.ids,
                        data: data,
                        success: function (ret) {
                            if(ret.code == 1){
                                Layer.alert(__('撤消成功'), function(index){
                                    location.reload();
                                });
                            }else
                            {
                                Layer.alert(ret.msg);
                            }

                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.close(index);
                });
            });
            $(".single_clear").click(function(event) {
                var that = this;
                var item_id = $(that).data("item_id");
                var data = {};
                data['item_id'] = item_id;
                Layer.confirm(__('确定要清空当前值吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "project/clearvalue/ids/"+ Config.ids,
                        data: data,
                        success: function (ret) {
                            if(ret.code == 1){
                                Layer.alert(__('清空成功'), function(index){
                                    location.reload();
                                });
                            }else
                            {
                                Layer.alert(ret.msg);
                            }

                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.close(index);
                });
            });
            $(".no_modify").click(function(event) {
                Layer.confirm(__('确认无修改提交吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: "project/nomodify" ,
                        data: {ids:Config.ids},
                        success: function (ret) {
                            if(ret.code == 1)
                                Layer.alert(__('提交成功'), function(index){
                                    parent.location.reload();
                                });
                            else
                                Layer.alert(ret.msg);
                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.closeAll();
                });
            })

            $(".pending").click(function(){
                var item_id =$(this).data('id');
                if(this.checked)
                {
                    $("#"+item_id).val("待定");
                    $("#"+item_id).attr('readonly','readonly');
                }
                else
                {
                    $("#"+item_id).val("");
                    require(['bootstrap-datetimepicker'], function () {
                        var options = {
                            format: 'YYYY-MM-DD HH:mm:ss',
                            icons: {
                                time: 'fa fa-clock-o',
                                date: 'fa fa-calendar',
                                up: 'fa fa-chevron-up',
                                down: 'fa fa-chevron-down',
                                previous: 'fa fa-chevron-left',
                                next: 'fa fa-chevron-right',
                                today: 'fa fa-history',
                                clear: 'fa fa-trash',
                                close: 'fa fa-remove'
                            },
                            showTodayButton: true,
                            showClose: true
                        };
                        $("#"+item_id).parent().css('position', 'relative');
                        $("#"+item_id).datetimepicker(options).on('dp.change', function (e) {
                            $(this, document).trigger("changed");
                        });
                    });
                    $("#"+item_id).removeAttr('readonly');
                }
            });
            //  $(".pending").click(function(){
            //     var item_id =$(this).data('id');
            //     if(this.checked)
            //     {
            //         $("#"+item_id).val("待定");
            //         $("#"+item_id).attr('readonly','readonly');
            //     }
            //     else
            //     {
            //         $("#"+item_id).val("");
            //         $("#"+item_id).removeAttr('readonly');
            //     }
            // });

            // $("#chargedep_ids").val(Config.chargedep_id);

            $('#carrier_id').change(function(event) {
                var value = $(this).val();
                var id = $(this).attr('id');

                var unit = '';
                var readonly = false;
                var required = null;
                switch (value) {
                    case "1":
                    case "6":
                        unit = "亩";
                        readonly = false;
                        required = "required";
                        break;
                    case "2":
                    case "3":
                    case "4":
                        unit = "平米";
                        readonly = false;
                        required = "required";
                        break;
                    case "5":
                        unit = "";
                        readonly = true;
                        required = null;
                        break;
                }
                $("#"+id+"_relation").attr('readonly', readonly);
                $("#"+id+"_addon").html(unit);

            });
            $("#is_access").change(function(event) {
                var value = $(this).val();
                if(value == '是')
                {
                    Layer.alert('请填写准入时间');
                    $("#group_access_time").show();
                    $("#group_access_remarks").hide();
                }else if(value == '无'){
                    Layer.alert('请填写备注');
                    $("#group_access_time").hide();
                    $("#group_access_remarks").show();
                }else{
                    $("#group_access_time").hide();
                    $("#group_access_remarks").hide();
                }

            });
            $("#is_land").change(function(event) {
                var value = $(this).val();
                if(value == '是') {
                    $("#group_land_time").show();
                    $("#group_start_construction_time").show();
                    Layer.alert('请填写拿地时间与开工时间');
                }else
                {
                    $("#group_land_time").hide();
                    $("#group_start_construction_time").hide();
                }

            });
            $("#is_command").change(function(event) {
                var value = $(this).val();
                if(value == '是') {
                    $("#group_command_type").show();
                    Layer.alert('请选择指挥部专题调度项目');
                }else{
                    $("#group_command_type").hide();
                }
            });

            // Controller.api.showLeaderApproachDesc(0);
            $("#project_source_ids").change(function(event) {
                var value = $(this).val();
                // console.log(value)
                var num = value.findIndex((value, index, arr) => {
                  return value == '32'
                })
                if(num == -1)
                {
                    $("#group_leader_approach_desc").hide();
                    // Controller.api.showLeaderApproachDesc(0);
                }
                else
                {
                    $("#group_leader_approach_desc").show();
                    Layer.alert('请填写区领导接洽情况');
                }
                // Controller.api.showLeaderApproachDesc(value);
            })

            $(".all_modidy_detail").click(function(event) {
                    var that = this;
                    // var item_id = $(that).data("item_id");
                    // // alert(item_id);
                    // var op = {};
                    // var filter = {};
                    // op.operate_field = '=';
                    // filter.operate_field = item_id;

                    var url ='project_checklog/fieldlog?pno='+ Config.pno ;
                    console.log(url);
                    // Backend.api.addtabs(url,'修改记录')
                    // window.open(url, "_newtab");
                    Fast.api.open(url, '', {area:['95%','95%']})
                })
            var form = $("form[role=edit-form]")


            Table.api.init();

            // var table1 = $("#table1");

            // // 初始化表格
            // table1.bootstrapTable({
            //     url: 'project_plan/index' + location.search,
            //     pk: 'id',
            //     sortName: 'id',
            //     toolbar: "#toolbar1",
            //     search: true,
            //     showExport: false,
            //     showToggle: false,
            //     showColumns: false,
            //     commonSearch: true,
            //     searchFormVisible: false,
            //     showSearch: false,
            //     queryParams: function(params) {
            //         params.filter = JSON.parse(params.filter);
            //         params.op = JSON.parse(params.op);
            //         params.filter.project_id = Config.ids;
            //         params.op.project_id= '=';
            //         params.filter = JSON.stringify(params.filter);
            //         params.op = JSON.stringify(params.op);
            //         return params;
            //     },
            //     extend: {
            //         del_url: 'project_plan/del',
            //     },
            //     columns: [
            //         [
            //             {checkbox: true},
            //             {field: 'id', title: __('Id')},
            //             {field: 'plan_time', title: __('日期'), operate:false, formatter: Table.api.formatter.datetime,datetimeFormat: 'YYYY-M-D'},
            //             {field: 'plan_content', title: __('内容')},
            //             {field: 'status', title: __('状态')},
            //             {field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
            //         ]
            //     ]
            // });

            // // 为表格绑定事件
            // Table.api.bindevent(table1);

            var table2 = $("#table2");

            // 初始化表格
            // table2.bootstrapTable({
            //     url: 'project_capital/index' + location.search,
            //     pk: 'id',
            //     sortName: 'id',
            //     toolbar: "#toolbar2",
            //     search: true,
            //     showExport: false,
            //     showToggle: false,
            //     showColumns: false,
            //     commonSearch: true,
            //     searchFormVisible: false,
            //     showSearch: false,
            //     queryParams: function(params) {
            //         params.filter = JSON.parse(params.filter);
            //         params.op = JSON.parse(params.op);
            //         params.filter.project_id = Config.ids;
            //         params.op.project_id= '=';
            //         params.filter = JSON.stringify(params.filter);
            //         params.op = JSON.stringify(params.op);
            //         return params;
            //     },
            //     extend: {
            //         del_url: 'project_plan/del',
            //     },
            //     columns: [
            //         [
            //             {checkbox: true},
            //             {field: 'id', title: __('Id')},
            //             {field: 'gained_time', title: __('日期'), operate:false, formatter: Table.api.formatter.datetime,datetimeFormat: 'YYYY-M-D'},
            //             {field: 'domestic_capital', title: __('内资资金')},
            //             {field: 'foreign_capital', title: __('外资资金')},
            //             {field: 'status', title: __('状态')},
            //             {field: 'operate', title: __('Operate'), table: table2, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
            //         ]
            //     ]
            // });

            // var table3 = $("#table3");

            // // 初始化表格
            // table3.bootstrapTable({
            //     url: 'project_formalities/index' + location.search,
            //     pk: 'id',
            //     sortName: 'id',
            //     toolbar: "#toolbar3",
            //     search: true,
            //     showExport: false,
            //     showToggle: false,
            //     showColumns: false,
            //     commonSearch: true,
            //     searchFormVisible: false,
            //     showSearch: false,
            //     queryParams: function(params) {
            //         params.filter = JSON.parse(params.filter);
            //         params.op = JSON.parse(params.op);
            //         params.filter.project_id = Config.ids;
            //         params.op.project_id= '=';
            //         params.filter = JSON.stringify(params.filter);
            //         params.op = JSON.stringify(params.op);
            //         return params;
            //     },
            //     extend: {
            //         del_url: 'project_formalities/del',
            //     },
            //     columns: [
            //         [
            //             {checkbox: true},
            //             {field: 'id', title: __('Id')},
            //             {field: 'formalities_name', title: __('手续名称')},
            //             {field: 'handel_time', title: __('办理日期'), operate:false, formatter: Table.api.formatter.datetime,datetimeFormat: 'YYYY-M-D'},
            //             {field: 'status', title: __('状态')},
            //             {field: 'operate', title: __('Operate'), table: table3, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
            //         ]
            //     ]
            // });
            // Table.api.bindevent(table2);
            Controller.api.viewchecklog();
            // Controller.api.custom_validator($("form[role=plan-form]"), table1);
            Controller.api.custom_validator($("form[role=capital-form]"), table2);
            // Controller.api.custom_validator($("form[role=formalities-form]"), table3);

            $("#qdzrnd").click(function(){
                var that = this;
                Layer.confirm(__('确定要转入该年度吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "project/switchyear",
                        data: {pno: $(that).data("pno"),toyear:$("#zrnd").val(),fromyear:$(that).data('fromyear')},
                        success: function (ret) {
                            Layer.alert(__('提交成功'), function(index){
                                location.reload();
                            });
                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.close(index);
                });
            });

        },
        initedit:function() {
            Form.api.bindevent($("form[role=form]"));
            var pre = Config.isSuperAdmin?"":"tmp_";
            // $("#"+pre+"chargedep_ids").val(Config.chargedep_id);
            $(".pending").click(function(){
                var item_id =$(this).data('id');
                if(this.checked)
                {
                    $("#"+item_id).val("待定");
                    $("#"+item_id).attr('readonly','readonly');
                }
                else
                {
                    $("#"+item_id).val("");
                    $("#"+item_id).removeAttr('readonly');
                }
            });
            $('#'+pre + "carrier_id").change(function(event) {

                var value = $(this).val();
                var id = $(this).attr('id');
                // alert(id);
                var unit = '';
                var readonly = false;
                var required = null;
                switch (value) {
                    case "1":
                        unit = "亩";
                        readonly = false;
                        required = "required";
                        break;
                    case "2":
                    case "3":
                    case "4":
                        unit = "平米";
                        readonly = false;
                        required = "required";
                        break;
                    case "5":
                        unit = "";
                        readonly = true;
                        required = null;
                        break;
                }

                $("#"+id+"_addon").html(unit);
                if(value == "5")
                {
                    $("form[role=form]").validator("setField", "row["+id+"_relation]", null);
                    $("#"+id+"_relation").removeAttr('aria-invalid');
                    $("#"+id+"_relation").attr('readonly','readonly');
                }
                else
                {
                    $("form[role=form]").validator("setField", "row["+id+"_relation]", required);
                    $("#"+id+"_relation").removeAttr('readonly')
                }

            });
            // alert(pre)

            Controller.api.showLand('否');
            $("#"+pre+"is_land").change(function(event) {
                var value = $(this).val();
                Controller.api.showLand(value);
            })
            Controller.api.showAccess('否');

            $("#"+pre+"is_access").change(function(event) {
                var value = $(this).val();
                Controller.api.showAccess(value);
            })

            Controller.api.showCommand('否');

            $("#"+pre+"is_command").change(function(event) {
                var value = $(this).val();
                Controller.api.showCommand(value);
            })
            // Controller.api.showLeaderApproachDesc(0);
            // $("#"+pre+"project_source_ids").change(function(event) {
            //     var value = $(this).val();
            //     if(value){
            //         var num = value.findIndex((value, index, arr) => {
            //           return value == '32'
            //         })
            //         if(num == -1)
            //             Controller.api.showLeaderApproachDesc(0);
            //         else
            //             Controller.api.showLeaderApproachDesc(1);
            //     }
            //     else
            //         Controller.api.showLeaderApproachDesc(0);

            //     // Controller.api.showLeaderApproachDesc(value);
            // })
        },
        checkedit: function () {
            Controller.api.bindevent();

            $(".single_submit").click(function(event) {
                // console.log($(this).data("item_id"));
                var that = this;
                Layer.confirm(__('确定要通过审核吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "project_2020_bak/checkpass/ids/"+ Config.ids,
                        data: {item_id: $(that).data("item_id")},
                        success: function (ret) {
                            Layer.alert(__('提交成功'), function(index){
                                location.reload();
                            });
                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.close(index);
                });

            });
            $(".single_reject").click(function(event) {
                var that = this;
                var item_id = $(that).data("item_id");
                var reject_value = $("#"+item_id+'_reject_desc').val();

                var data = {};
                data['reject_desc'] = reject_value;
                data['item_id'] = item_id;
                Layer.confirm(__('确定要驳回吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "project_2020_bak/checkreject/ids/"+ Config.ids,
                        data: data,
                        success: function (ret) {
                            if(ret.code == 1){
                                Layer.alert(__('驳回成功'), function(index){
                                    location.reload();
                                });
                            }else
                            {
                                Layer.alert(ret.msg);
                            }
                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.close(index);
                });
            });



            $(".all_submit").click(function(event) {
                // console.log($(this).data("item_id"));
                var that = this;
                Layer.confirm(__('确定所有要通过审核吗?'), {
                    icon: 3,
                    title: '提示'
                }, function (index) {
                    $.ajax({
                        //几个参数需要注意一下
                        type: "POST",//方法类型
                        dataType: "json",//预期服务器返回的数据类型
                        url: "project_2020_bak/checkpass_all/ids/"+ Config.ids,
                        success: function (ret) {
                            Layer.alert(__('提交成功'), function(index){
                                location.reload();
                            });
                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                    Layer.close(index);
                });

            });

            $(".btn-rejectmemo").click(function(event) {
                // alert("aaa");
                var that = this;

                var url = 'project_2020_bak/rejectmemo/ids/' + Config.ids;

                Fast.api.open(url, __('驳回备注'),  {});
            });
            Controller.api.viewchecklog();
        },
        discuss_add: function() {
            // var form = $("form[role=form]");
            // Form.api.bindevent($("form[role=form]"));
            Controller.api.bindevent();
            var pre = Config.isSuperAdmin?"":"tmp_";
            $(".pending").click(function(){
                var item_id =$(this).data('id');
                // alert("aaaa");
                if(this.checked)
                {
                    $("#"+item_id).val("待定");
                    $("#"+item_id).attr('readonly','readonly');
                }
                else
                {
                    $("#"+item_id).val("");
                    $("#"+item_id).removeAttr('readonly');
                }
            });

            // Controller.api.showLand('0');

            // $("#"+pre+"is_land").change(function(event) {
            //     var value = $(this).val();
            //     // alert(value);
            //     Controller.api.showLand(value);
            // })
            //
            Controller.api.showAccess('否');
            $("#"+pre+"is_access").change(function(event) {
                var value = $(this).val();
                Controller.api.showAccess(value);
            })

            Controller.api.showCommand('否');
            $("#"+pre+"is_command").change(function(event) {
                var value = $(this).val();
                Controller.api.showCommand(value);
            })
            // Controller.api.showLeaderApproachDesc(0);
            // $("#"+pre+"project_source_ids").change(function(event) {
            //     var value = $(this).val();
            //     if(value){
            //         var num = value.findIndex((value, index, arr) => {
            //           return value == '32'
            //         })
            //         if(num == -1)
            //             Controller.api.showLeaderApproachDesc(0);
            //         else
            //             Controller.api.showLeaderApproachDesc(1);
            //     }
            //     else
            //         Controller.api.showLeaderApproachDesc(0);

            //     // Controller.api.showLeaderApproachDesc(value);
            // })

        },
        signed_add: function() {

            Form.api.bindevent($("form[role=form]"));
            // Controller.api.bindevent();
            var pre = Config.isSuperAdmin?"":"tmp_";
            $("#"+pre+"chargedep_ids").val(Config.chargedep_id);
            $(".pending").click(function(){
                var item_id =$(this).data('id');
                if(this.checked)
                {
                    $("#"+item_id).val("待定");
                    $("#"+item_id).attr('readonly','readonly');
                }
                else
                {
                    $("#"+item_id).val("");
                    $("#"+item_id).removeAttr('readonly');
                }
            });
            $('#'+pre + "carrier_id").change(function(event) {

                var value = $(this).val();
                var id = $(this).attr('id');
                // alert(id);
                var unit = '';
                var readonly = false;
                var required = null;
                switch (value) {
                    case "1":
                    case "6":
                        unit = "亩";
                        readonly = false;
                        required = "required";
                        break;
                    case "2":
                    case "3":
                    case "4":
                        unit = "平米";
                        readonly = false;
                        required = "required";
                        break;
                    case "5":
                        unit = "";
                        readonly = true;
                        required = null;
                        break;
                }

                $("#"+id+"_addon").html(unit);
                if(value == "5")
                {
                    $("form[role=form]").validator("setField", "row["+id+"_relation]", null);
                    $("#"+id+"_relation").removeAttr('aria-invalid');
                    $("#"+id+"_relation").attr('readonly','readonly');
                }
                else
                {
                    $("form[role=form]").validator("setField", "row["+id+"_relation]", required);
                    $("#"+id+"_relation").removeAttr('readonly')
                }

            });
            // alert(pre)

            Controller.api.showLand('否');
            $("#"+pre+"is_land").change(function(event) {
                var value = $(this).val();
                Controller.api.showLand(value);
            })
            Controller.api.showAccess('否');
            $("#"+pre+"is_access").change(function(event) {
                var value = $(this).val();
                Controller.api.showAccess(value);
            })
            Controller.api.showCommand('否');

            $("#"+pre+"is_command").change(function(event) {
                var value = $(this).val();
                Controller.api.showCommand(value);
            })
            Controller.api.showLeaderApproachDesc(0);
            $("#"+pre+"project_source_ids").change(function(event) {
                var value = $(this).val();
                if(value){
                    var num = value.findIndex((value, index, arr) => {
                      return value == '32'
                    })
                    if(num == -1)
                        Controller.api.showLeaderApproachDesc(0);
                    else
                        Controller.api.showLeaderApproachDesc(1);
                }
                else
                    Controller.api.showLeaderApproachDesc(0);

                // Controller.api.showLeaderApproachDesc(value);
            })

            $("#"+pre+"project_socialized").change(function(event) {
                    var value = $(this).val();
                    // alert(value);
                    // alert(value)内资
                    if(value == "是")
                    {
                        $(".socialized").show();
                        if(Config.isSuperAdmin)
                        {
                            $("form[role=form]").validator("setField", {
                                "row[referrer]": "required;",
                                "row[first_registration_time]": "required(#first_registration_images:filled)",
                                "row[first_registration_images]": "required(#first_registration_time:filled)",
                                "row[second_registration_time]": "required(#second_registration_images:filled)",
                                "row[second_registration_images]": "required(#second_registration_time:filled)",
                                "row[final_confirm_time]": "required(#final_confirm_images:filled)",
                                "row[final_confirm_images]": "required(#final_confirm_time:filled)",
                                "row[reward_application_time]": "required(#reward_application_images:filled)",
                                "row[reward_application_images]": "required(#reward_application_time:filled)",
                            });
                        }else{
                            $("form[role=form]").validator("setField", {
                                "row[tmp_referrer]": "required;",
                                "row[tmp_first_registration_time]": "required(#tmp_first_registration_images:filled)",
                                "row[tmp_first_registration_images]": "required(#tmp_first_registration_time:filled)",
                                "row[tmp_second_registration_time]": "required(#tmp_second_registration_images:filled)",
                                "row[tmp_second_registration_images]": "required(#tmp_second_registration_time:filled)",
                                "row[tmp_final_confirm_time]": "required(#tmp_final_confirm_images:filled)",
                                "row[tmp_final_confirm_images]": "required(#tmp_final_confirm_time:filled)",
                                "row[tmp_reward_application_time]": "required(#tmp_reward_application_images:filled)",
                                "row[tmp_reward_application_images]": "required(#tmp_reward_application_time:filled)",
                            });
                        }

                    }
                    else
                    {
                        $(".socialized").hide();
                        if(Config.isSuperAdmin){
                            $("form[role=form]").validator("setField", {
                                "row[referrer]": null,
                                "row[first_registration_time]": null,
                                "row[first_registration_images]": null,
                                "row[second_registration_time]": null,
                                "row[second_registration_images]": null,
                                "row[final_confirm_time]": null,
                                "row[final_confirm_images]": null,
                                "row[reward_application_time]": null,
                                "row[reward_application_images]": null,
                            });
                        }
                        else{
                             $("form[role=form]").validator("setField", {
                                "row[tmp_referrer]": null,
                                "row[tmp_first_registration_time]": null,
                                "row[tmp_first_registration_images]": null,
                                "row[tmp_second_registration_time]": null,
                                "row[tmp_second_registration_images]": null,
                                "row[tmp_final_confirm_time]": null,
                                "row[tmp_final_confirm_images]": null,
                                "row[tmp_reward_application_time]": null,
                                "row[tmp_reward_application_images]": null,
                            });
                        }
                        $(".socialized input").removeAttr('aria-invalid');
                    }

                });

        },
        major_add: function() {

            Form.api.bindevent($("form[role=form]"));
            // Controller.api.bindevent();
            var pre = Config.isSuperAdmin?"":"tmp_";
            $("#"+pre+"chargedep_ids").val(Config.chargedep_id);
            $(".pending").click(function(){
                var item_id =$(this).data('id');
                if(this.checked)
                {
                    $("#"+item_id).val("待定");
                    $("#"+item_id).attr('readonly','readonly');
                }
                else
                {
                    $("#"+item_id).val("");
                    $("#"+item_id).removeAttr('readonly');
                }
            });
            $('#'+pre + "carrier_id").change(function(event) {

                var value = $(this).val();
                var id = $(this).attr('id');
                // alert(id);
                var unit = '';
                var readonly = false;
                var required = null;
                switch (value) {
                    case "1":
                    case "6":
                        unit = "亩";
                        readonly = false;
                        required = "required";
                        break;
                    case "2":
                    case "3":
                    case "4":
                        unit = "平米";
                        readonly = false;
                        required = "required";
                        break;
                    case "5":
                        unit = "";
                        readonly = true;
                        required = null;
                        break;
                }

                $("#"+id+"_addon").html(unit);
                if(value == "5")
                {
                    $("form[role=form]").validator("setField", "row["+id+"_relation]", null);
                    $("#"+id+"_relation").removeAttr('aria-invalid');
                    $("#"+id+"_relation").attr('readonly','readonly');
                }
                else
                {
                    $("form[role=form]").validator("setField", "row["+id+"_relation]", required);
                    $("#"+id+"_relation").removeAttr('readonly')
                }

            });
            // alert(pre)

            Controller.api.showLand('否');
            $("#"+pre+"is_land").change(function(event) {
                var value = $(this).val();
                Controller.api.showLand(value);
            })
            Controller.api.showAccess('否');
            $("#"+pre+"is_access").change(function(event) {
                var value = $(this).val();
                Controller.api.showAccess(value);
            })
            Controller.api.showCommand('否');

            $("#"+pre+"is_command").change(function(event) {
                var value = $(this).val();
                Controller.api.showCommand(value);
            })
        },
        rejectmemo:function() {
            Form.api.bindevent($("form[role=form]"));
        },
        addsuspend: function() {
            Form.api.bindevent($("form[role=form]"));
        },
        api: {
            bindevent: function () {

                Form.api.bindevent($("form[role=form]"));
                var pre = Config.pre;


            },
            showLand:function(value){

                console.log(value);

                if(value == '是'){
                    Layer.alert('请填写拿地时间和开工时间');
                    if(Config.isSuperAdmin)
                    {
                        $("form[role=form]").validator("setField", {
                            "row[land_time]": "required;",
                            "row[start_construction_time]": "required;",

                        });
                    }else{
                        $("form[role=form]").validator("setField", {
                            "row[tmp_land_time]": "required;",
                            "row[tmp_start_construction_time]": "required;",
                        });
                    }
                    $(".div-land_time").show();
                    $(".div-start_construction_time").show();
                }else{

                    $(".div-land_time").hide();
                    $(".div-start_construction_time").hide();
                    if(Config.isSuperAdmin){
                        $("form[role=form]").validator("setField", {
                            "row[land_time]": null,
                            "row[start_construction_time]": null,
                        });

                    }
                    else{
                         $("form[role=form]").validator("setField", {
                            "row[tmp_land_time]": null,
                            "row[tmp_start_construction_time]": null,
                        });
                    }
                    $(".land_time").removeAttr('aria-invalid');
                    $(".start_construction_time").removeAttr('aria-invalid');

                }
            },
            showAccess:function(value){
                console.log(value);
                if(value == '是'){

                    Layer.alert('请填写准入时间');
                    if(Config.isSuperAdmin)
                    {
                        $("form[role=form]").validator("setField", {
                            "row[access_time]": "required;",
                        });
                    }else{
                        $("form[role=form]").validator("setField", {
                            "row[tmp_access_time]": "required;",
                        });
                    }
                    $(".div-access_time").show();
                    $(".div-access_remarks").hide();
                }else if(value == '无'){
                    Layer.alert('请填写备注');
                    $("form[role=form]").validator("setField", {
                            "row[access_remarks]": "required;",
                    });

                    $(".div-access_time").hide();
                    $(".div-access_remarks").show();
                }else{

                    $(".div-access_time").hide();
                    $(".div-access_remarks").hide();
                    if(Config.isSuperAdmin){
                        $("form[role=form]").validator("setField", {
                            "row[access_time]": null,
                        });
                    }
                    else{
                         $("form[role=form]").validator("setField", {
                            "row[tmp_access_time]": null,
                        });
                    }
                    $(".access_time").removeAttr('aria-invalid');

                }
            },

            showCommand:function(value){
                // console.log(value);
                if(value == '是'){
                    Layer.alert('请选择指挥部专题调度项目');
                    if(Config.isSuperAdmin)
                    {
                        $("form[role=form]").validator("setField", {
                            "row[command_type]": "required;",
                        });
                    }else{
                        $("form[role=form]").validator("setField", {
                            "row[tmp_command_type]": "required;",
                        });
                    }
                    $(".div-command_type").show();
                }else{
                    $(".div-command_type").hide();
                    if(Config.isSuperAdmin){
                        $("form[role=form]").validator("setField", {
                            "row[command_type]": null,
                        });
                    }else{
                         $("form[role=form]").validator("setField", {
                            "row[tmp_command_type]": null,
                        });
                    }
                }
            },

            showLeaderApproachDesc:function(value){
                if(value == 1){
                    Layer.alert('请填区领导接洽情况');
                    if(Config.isSuperAdmin)
                    {
                        $("form[role=form]").validator("setField", {
                            "row[leader_approach_desc]": "required;",
                        });
                    }else{
                        $("form[role=form]").validator("setField", {
                            "row[tm_leader_approach_desc]": "required;",
                        });
                    }
                    $(".div-leader_approach_desc").show();
                }else{

                    $(".div-leader_approach_desc").hide();
                    if(Config.isSuperAdmin){
                        $("form[role=form]").validator("setField", {
                            "row[leader_approach_desc]": null,
                        });
                    }
                    else{
                         $("form[role=form]").validator("setField", {
                            "row[tm_leader_approach_desc]": null,
                        });
                    }
                    $(".leader_approach_desc").removeAttr('aria-invalid');

                }

            },
            viewchecklog: function() {
                $(".field_detail").click(function(event) {
                    var that = this;
                    var item_id = $(that).data("item_id");
                    // alert(item_id);
                    var op = {};
                    var filter = {};
                    op.operate_field = '=';
                    filter.operate_field = item_id;

                    var url ='project_checklog/fieldlog?operate_field=' + item_id+'&pno='+ Config.pno ;
                    console.log(url);
                    // Backend.api.addtabs(url,'修改记录')
                    // window.open(url, "_newtab");
                    Fast.api.open(url, '', {area:['95%','95%']})
                })
            },
            custom_bindvent: function (form) {
                var events = Form.events;
                events.datetimepicker(form);
                events.selectpicker(form);
            },
            custom_validator: function(form, table) {
                form.on('valid.form', function(e, fform){
                    var type = form.attr("method") ? form.attr("method").toUpperCase() : 'GET';
                    type = type && (type === 'GET' || type === 'POST') ? type : 'GET';
                    url = form.attr("action");
                    console.log(type,url)
                    $.ajax({
                        type: type,
                        url: url,
                        data: form.serialize(),
                        success: function (ret) {
                            Layer.alert(__('添加成功'));
                            table.bootstrapTable('refresh');
                        },
                        error : function(error) {
                            console.log(error);
                        }
                    });
                });
            },
            bindeventTable: function (table) {
                var parenttable = table.closest('.bootstrap-table');
                //Bootstrap-table配置
                var options = table.bootstrapTable('getOptions');
                // console.log(options);
                //Bootstrap操作区
                var toolbar = $(options.toolbar, parenttable);

                table.on('dbl-click-row.bs.table', function (e, row, element, field) {
                    // Layer.alert(__('请到正式库进行编辑'));
                    var url = options.extend.edit_url;
                     row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
                    var url = Table.api.replaceurl(url, row, table);
                    var icon = 'fa fa-pencil';
                    Backend.api.addtabs(url, '编辑', icon);
                    $('.btn-modi', element).trigger("click");
                });
                // console.log(toolbar);
                // $(".btn-customedit").click(function(event) {
                //     /* Act on the event */alert("aaaa");
                // });
                // alert("aaaa");
                // console.log(toolbar)
                $(toolbar).on('click', ".btn-customedit", function () {
                    var that = this;
                    //循环弹出多个编辑框
                    console.log(Config.chargedep_id);
                    $.each(table.bootstrapTable('getSelections'), function (index, row) {
                        var url = options.extend.edit_url;
                        row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
                        var url = Table.api.replaceurl(url, row, table);
                        var icon = 'fa fa-pencil';
                        if(row.chargedep_ids)
                        {
                            var chargedep_ids_arr = row.chargedep_ids.split(',');

                            idx= chargedep_ids_arr.findIndex(function(item){
                                return parseInt(item) == parseInt(Config.chargedep_id);
                            })
                        }


                        if(Config.isSuperAdmin || idx!=-1 )
                            Backend.api.addtabs(url, '编辑', icon);

                        else
                            Layer.alert(__('此项目仅供查看'));


                        // Fast.api.open(url, __('Edit'), $(that).data() || {});
                    });
                });
                $(toolbar).on('click', ".btn-detail", function () {
                    var that = this;
                    //循环弹出多个编辑框
                    $.each(table.bootstrapTable('getSelections'), function (index, row) {
                        var url = 'project_2020_bak/detail';
                        row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
                        var url = Table.api.replaceurl(url, row, table);
                        var icon = 'fa fa-info';
                        Backend.api.addtabs(url, '详情', icon);
                        // Fast.api.open(url, __('详情'), $(that).data() || {});
                    });
                });

                $(toolbar).on('click', ".btn-customadd", function () {
                    var that = this;
                    //循环弹出多个编辑框
                    var ids = Table.api.selectedids(table);
                    var url = options.extend.add_url;
                    if (url.indexOf("{ids}") !== -1) {
                        url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
                    }
                    var icon = 'fa fa-plus';
                    // alert("aaaa");
                    console.log( $(this).data());
                    if(Config.library_id == 1)
                        title = '在谈--添加';
                    if(Config.library_id == 2)
                    {
                        if(Config.is_important == 1)
                            title = '重大活动签约--添加';
                        else
                            title = '签约--添加';
                    }
                    Fast.api.open(url, title, {area:["100%", "100%"]});
                    // Backend.api.addtabs(url, '添加', icon);
                });

                $(toolbar).on('click', ".btn-mark", function () {

                    var that = this;
                    //循环弹出多个编辑框
                    var ids = Table.api.selectedids(table);
                    var url = 'project_2020_bak/mark/ids/{ids}';
                    if (url.indexOf("{ids}") !== -1) {
                        url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
                    }
                    var type = $(this).data("type");
                    // alert(type)
                    Fast.api.ajax({
                        url: url,
                        data: {type: type},
                    }, function (data, ret) {
                        // table.trigger("uncheckbox");
                        table.bootstrapTable('refresh');
                    });
                    // Backend.api.addtabs(url, '添加', icon);
                });

                $(toolbar).on('click', ".btn-rejectmemo", function () {
                    // alert("aaa");
                    var that = this;
                    //循环弹出多个编辑框
                    var ids = Table.api.selectedids(table);
                    var url = 'project_2020_bak/rejectmemo/ids/{ids}';
                    if (url.indexOf("{ids}") !== -1) {
                        url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
                    }
                    Fast.api.open(url, __('驳回备注'),  {});
                });

                $(toolbar).on('click', ".btn-suspend", function () {
                    // alert("aaa");
                    var that = this;
                    //循环弹出多个编辑框
                    var ids = Table.api.selectedids(table);
                    var url = 'project_2020_bak/addsuspend/ids/{ids}';
                    if (url.indexOf("{ids}") !== -1) {
                        url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
                    }
                    Fast.api.open(url, __('设置项目状态'),  {});
                });

                $(toolbar).on('click', ".btn-export", function () {
                    var library_id = $(this).data('library_id');
                    console.log(library_id);
                    var options = table.bootstrapTable('getOptions');
                    var search = options.queryParams({});
                    var filter = search.filter;
                    var op = search.op;
                    // console.log(filter)
                    // console.log(op)
                    if(library_id == 1)
                        url = 'exportdiscuss';
                    if(library_id == 2)
                        url = 'exportsigned';
                    if(library_id == 6) //后期2020年签约新政地项目
                        url = 'exportnew';
                    // console.log(url + '?filter='+filter+'&op='+op);
                    if(url)
                        location.href= url + '?filter='+filter+'&op='+op;
                });

                $(toolbar).on('click', ".btn-convert", function () {
                    // alert("aaa");
                    var that = this;
                    //循环弹出多个编辑框
                    var ids = Table.api.selectedids(table);
                    var selectedData = Table.api.selecteddata(table, true);
                    console.log(selectedData);
                    var row = selectedData[0];
                    var url = 'project_2020_bak/multi/ids/{ids}';
                    if (url.indexOf("{ids}") !== -1) {
                        url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
                    }
                     row = $.extend({}, row ? row : {}, {ids: row[options.pk]});
                    if(row.chargedep_ids)
                    {
                        var chargedep_ids_arr = row.chargedep_ids.split(',');

                        idx= chargedep_ids_arr.findIndex(function(item){
                            return parseInt(item) == parseInt(Config.chargedep_id);
                        })
                    }


                    if(Config.isSuperAdmin || idx!=-1 )
                    {
                        Layer.confirm(__('确定要转签约库吗?'), function () {
                        // var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
                            Fast.api.ajax({
                                url:url,
                                data: {
                                    params:'is_convert=1&convert_memo=转入待审核'
                                }
                            }, function (data, ret) {
                                Layer.closeAll();
                                // table.trigger("uncheckbox");
                                table.bootstrapTable('refresh');
                                if(ret && ret.code == 1)
                                {
                                    Layer.alert('提交成功，等待管理员审核');
                                }
                            }, function () {
                                Layer.closeAll();
                            });
                        });
                    }
                    else
                        Layer.alert(__('此项目仅供查看'));


                    return false;
                });

                $(toolbar).on('click', ".btn-major", function () {
                    // alert("aaa");
                    var that = this;
                    //循环弹出多个编辑框
                    var ids = Table.api.selectedids(table);
                    var url = 'project_2020_bak/convert_major/ids/{ids}';
                    if (url.indexOf("{ids}") !== -1) {
                        url = Table.api.replaceurl(url, {ids: ids.length > 0 ? ids.join(",") : 0}, table);
                    }
                    Layer.confirm(__('确定要转重大项目吗?'), function () {
                        // var url = $(that).data("url") ? $(that).data("url") : $(that).attr("href");
                        Fast.api.ajax(url, function (data, ret) {
                            Layer.closeAll();
                            // table.trigger("uncheckbox");
                            table.bootstrapTable('refresh');
                            if(ret && ret.code == 1)
                            {
                                Layer.alert('项目已转入重大项目签约库');
                            }
                        }, function () {
                            Layer.closeAll();
                        });
                    });
                    return false;
                });

            },
            bindSubmitSingle: function(_this, type) {
                // console.log($("#industry_category_ids").val());
                type = typeof type === 'undefined' ? 0 : type;
                var item_id = $(_this).data("item_id");

                // var value_name = $("#"+item_id).attr("name");
                var value = $("#"+item_id).val();

                var desc_value = $("#"+item_id+'_submit_desc').val();
                var required = $("#"+item_id+'_submit_desc').data('required');

                var data = {};


                if(type ) {
                    if(!value )
                    {
                        Layer.alert(__('请填写修改内容'));
                        return false;
                    }

                    if(!Config.isSuperAdmin && !desc_value)
                    {
                         Layer.alert(__('请填写修改原因'));
                         return false;
                    }
                }
                else {
                    if(!value && !desc_value)
                    {
                        Layer.alert(__('您未有要提交的数据'));
                        return false;
                    }
                }
                // console.log(item_id);
                if(item_id == 'carrier_id' )
                {
                    relation_value = $("#"+item_id+'_relation').val();
                    if(value != '5' && relation_value == '')
                    {
                        Layer.alert(__('请填写载体面积'));
                        return false;
                    }
                    data['row[value_relation]'] = relation_value;

                }

                if(item_id == 'is_access')
                {
                    if (value=='是'){
                        relation_value = $("#access_time").val();
                        relation_desc_value = $("#access_time_submit_desc").val();
                        if(relation_value ==''){
                            Layer.alert(__('请填写准入时间3333'));
                            return false;
                        }
                        data['row[relation_value]'] = relation_value;
                        data['row[relation_desc_value]'] = relation_desc_value;
                    }
                    if (value=='无'){
                        relation_value = $("#access_remarks").val();
                        relation_desc_value = $("#access_remarks_submit_desc").val();
                        if(relation_value ==''){
                            Layer.alert(__('请填写无须备注3333'));
                            return false;
                        }
                        data['row[relation_value]'] = relation_value;
                        data['row[relation_desc_value]'] = relation_desc_value;
                    }

                }

                if(item_id == 'access_time')
                {
                    relation_value = $("#is_access").val();
                    relation_desc_value = $("#is_access_submit_desc").val();
                    if(relation_value == '否'||relation_value == '无')
                    {
                        Layer.alert(__('是否已上过准入例会:请选择是'));
                        return false;
                    }
                    if(relation_value == '是'){
                        data['row[relation_value]'] = relation_value;
                        data['row[relation_desc_value]'] = relation_desc_value;
                    }
                }
                if(item_id == 'access_remarks')
                {
                    relation_value = $("#is_access").val();
                    relation_desc_value = $("#is_access_submit_desc").val();
                    if(relation_value == '否'||relation_value == '是')
                    {
                        Layer.alert(__('无须上准入例会:请选择无'));
                        return false;
                    }
                    if(relation_value == '无'){
                        data['row[relation_value]'] = relation_value;
                        data['row[relation_desc_value]'] = relation_desc_value;
                    }
                }

                if(item_id == 'is_command')
                {
                    relation_value = $("#command_type").val();
                    relation_desc_value = $("#command_type_submit_desc").val();
                    if(value == '是' && relation_value ==''){
                        Layer.alert(__('请选择指挥部专题调度项目'));
                        return false;
                    }
                    data['row[relation_value]'] = relation_value;
                    data['row[relation_desc_value]'] = relation_desc_value;
                }

                if(item_id == 'is_land')
                {
                    relation_value = $("#land_time").val();
                    relation_desc_value = $("#land_time_submit_desc").val();
                    relation_value2 = $("#start_construction_time").val();
                    relation_desc_value2 = $("#start_construction_time_submit_desc").val();
                    if(value == '是' && relation_value ==''){
                        Layer.alert(__('请填写拿地时间和开工时间'));
                        return false;
                    }
                    data['row[relation_value]'] = relation_value;
                    data['row[relation_desc_value]'] = relation_desc_value;
                    data['row[relation_value2]'] = relation_value2;
                    data['row[relation_desc_value2]'] = relation_desc_value2;
                }

                if(item_id == 'project_source_ids')
                {
                    relation_value = $("#leader_approach_desc").val();
                    relation_desc_value = $("#leader_approach_desc_submit_desc").val();
                    var num = value.findIndex((value, index, arr) => {
                      return value == '32'
                    })
                    if(num >-1 && relation_value ==''){
                        Layer.alert(__('请填写区领导接洽情况'));
                        return false;
                    }
                    data['row[relation_value]'] = relation_value;
                    data['row[relation_desc_value]'] = relation_desc_value;

                }

                data['row[value]'] = value;
                data['row[desc_value]'] = desc_value;

                data.item_id = item_id;
                if(type)
                    data['row[status]'] = 100;
                $.ajax({
                //几个参数需要注意一下
                    type: "POST",//方法类型
                    dataType: "json",//预期服务器返回的数据类型
                    url: location.href ,//url
                    data: data,
                    success: function (ret) {
                        if(ret.code == 1)
                        {
                            Layer.alert(__('提交成功'), function(index){
                                location.reload();
                            });
                        }

                        // location.reload();
                    },
                    error : function(error) {
                        console.log(error);
                    }
                });

            },
            bindSubmitAll:function(type) {
                type = typeof type === 'undefined' ? 0 : type;
                var errors = [];
                var data = {};
                $(".form_value").each(function(){
                    // console.log($(this))

                    var item_id = $(this).attr('id');
                    var item_value = $(this).val();

                    if(item_id )
                    {
                        // console.log(item_id+','+item_value);
                        var item_label =  $("#"+item_id+"_label").html();
                        var item_value_desc = $("#"+item_id+"_submit_desc").val();
                        var item_required = $("#"+item_id+'_submit_desc').data('required');

                        if(type && item_value && !(item_value=='0.0000') && item_required && !item_value_desc)
                        {
                            errors.push('请填写'+item_label+'修改原因');
                        }

                        if(item_id == 'carrier_id' && item_value && item_value!='5')
                        {
                            var relation_value = $("#"+item_id+"_relation").val();
                            if(!relation_value)
                                errors.push('请填写载体面积');
                            data['row['+item_id+'][relation_value]'] = relation_value;
                        }

                        data['row['+item_id+'][value]'] = item_value;

                        data['row['+item_id+'][desc_value]'] = item_value_desc;
                        if(type && item_value && !(item_value=='0.0000'))
                            data['row['+item_id+'][status]'] = 100;
                    }
                });
                // console.log($.isEmptyObject(data));

                if(type && errors.length > 0){
                    Layer.alert(errors.join("<br>"));
                    return false;
                }

                if($.isEmptyObject(data))
                {
                    Layer.alert('您没有要提交的数据，请填写后再提交');
                    return false;
                }
                data['type'] = type;
                $.ajax({
                //几个参数需要注意一下
                    type: "POST",//方法类型
                    dataType: "json",//预期服务器返回的数据类型
                    url: 'project_2020_bak/editall/ids/' + Config.ids,//url
                    data: data,
                    success: function (ret) {
                        if(ret.code == 1)
                            Layer.alert(__('提交成功'), function(index){
                                location.reload();
                            });
                        else{
                             Layer.alert(ret.msg);
                        }
                        // location.reload();
                    },
                    error : function(error) {
                        console.log(error);
                    }
                })

            },
            columns: function(table,show_check,show_edit,show_memo,show_status) {
                var pre_columns = [
                    {checkbox: true,width:'10px',},


                    // {
                    //     field: '',
                    //     title: __(''),
                    //     width:'90px',
                    //     operate:false,
                    //     formatter: function (value,row,index)
                    //     {
                    //         var length= '';
                    //         // 图标，管理员，街道，领导，双招双引才可查看
                    //         if(Config.groupIds==1||Config.groupIds==2||Config.groupIds==4||Config.groupIds==5)
                    //         {
                    //             // 再谈库
                    //             if(Config.library_id==1)
                    //             {
                    //                 // 在谈库3个月转签约库的框架协议，

                    //                 // 框架协议
                    //                 var e = row.framework_agreement_time*1000;
                    //                 if(e==0)
                    //                     var e = Date.parse(new Date());
                    //                 // 意向时间不为空的，
                    //                 if(row.intention_time>0)
                    //                 {
                    //                     var s = row.intention_time*1000;
                    //                 }else{
                    //                     // 意向时间为空 1608393600 2020-12-20
                    //                     var s = 1608393600*1000;
                    //                 }
                    //                 var utc=e-s;
                    //                 // console.log(utc);
                    //                 var day = utc/(24*60*60)/1000;// 天
                    //                 console.log(day+"@@@@@@@@@@");
                    //                 if(day>90)
                    //                 length +='<a class="btn btn-xs btn-warning" title="在谈项目转签约已超时限（3个月）"><i class="fa fa-mail-reply-all"></i></a>&nbsp;&nbsp;';
                    //             }

                    //             // 签约库
                    //             if(Config.library_id==2)
                    //             {
                    //                 //框架协议到正式协议，时限1个月
                    //                 if(row.framework_agreement_time>0)
                    //                 {
                    //                     var s = row.framework_agreement_time*1000;
                    //                     var e = row.invesment_agreement_time*1000;
                    //                     if(e==0)
                    //                         var e = Date.parse(new Date());
                    //                     var utc=e-s;
                    //                     var day = utc/(24*60*60)/1000;// 天
                    //                     console.log(day+'#####')
                    //                     if(day>30)
                    //                         length +='<a class="btn btn-xs btn-danger" title="框架协议到正式协议已超时限（1个月）"><i class="fa fa-times"></i></a>&nbsp;&nbsp;'
                    //                 }
                    //                 // 从正式协议到注册落地时限1个月
                    //                 if(row.invesment_agreement_time>0)
                    //                 {
                    //                     var s = row.invesment_agreement_time*1000;
                    //                     var e = row.register_time*1000;
                    //                     if(e==0)
                    //                         var e = Date.parse(new Date());
                    //                     var utc=e-s;
                    //                     var day = utc/(24*60*60)/1000;// 天
                    //                     console.log(day+'@@@@@')
                    //                     if(day>30)
                    //                         length +='<a class="btn btn-xs btn-info" title="正式协议到注册落地已超时限（1个月）"><i class="fa fa-arrows"></i></a>&nbsp;&nbsp;';
                    //                 }
                    //                 // 从注册落地到项目拿地时限6个月（若涉及土地为新增土地指标延长3个月，即9个月）
                    //                 if(row.register_time>0)//注册落地时间
                    //                 {
                    //                     // 确认拿地 并且拿地时间不为空
                    //                     if(row.is_land=='是' &&row.land_time>0)
                    //                     {
                    //                         var s = row.register_time*1000;
                    //                         var e = row.land_time*1000;
                    //                         if(e==0)
                    //                             var e = Date.parse(new Date());

                    //                         var utc=e-s;
                    //                         var day = utc/(24*60*60)/1000;// 天
                    //                         console.log(day+'%%%%%')
                    //                         // 土地新增指标为是
                    //                         if(row.is_newland=='是')
                    //                         {
                    //                             if(day>270)
                    //                             length +='<a class="btn btn-xs btn-primary" title="注册落地到项目拿地已超时限（涉及新增土地指标为9个月）"><i class="fa fa fa-sign-language"></i></a>&nbsp;&nbsp;';
                    //                         }
                    //                         // 土地新增指标为否
                    //                         if (row.is_newland=='否')
                    //                         {
                    //                             if(day>180)
                    //                             length +='<a class="btn btn-xs btn-primary" title="注册落地到项目拿地已超时限（6个月）"><i class="fa fa fa-sign-language"></i></a>';
                    //                         }
                    //                     }

                    //                 }
                    //             }
                    //         }
                    //         return length;

                    //     }
                    // },



                    {field: '', title: __('序号'),operate:false,table: table,width:'20px',formatter:Table.api.formatter.natureorder},



                    // {field: 'id', title: __('Id'),operate:false},
                ];
                var operate_columns = [];
                var check_columns = [];
                var common_columns = [];
                if(show_check && Config.isSuperAdmin)
                {


                }
                if(Config.library_id!=6) //2020年签约新政地项目 不用显示状态
                {
                    if(show_status)
                    {
                        check_columns = [
                            {field: 'status',title:'状态',operate:false,
                                formatter: function (value,row,index) {
                                    if(value == 1)
                                    {
                                        if(Config.isSuperAdmin)
                                            return '<a href="project_2020_bak/checkedit/ids/'+row.id+'" class="btn btn-danger   btn-addtabs btn-xs" title="审核">待审核</a>';
                                        else
                                            return '<a href="javascript:;" class="btn btn-danger   btn-xs" title="审核">待审核</a>';
                                    }
                                    if(value == 0)
                                        if(Config.isSuperAdmin)
                                            return '<a href="project_2020_bak/checkedit/ids/'+row.id+'" class="btn btn-success  btn-addtabs btn-xs " title="已审核">已审核</a>';
                                        else
                                            return '<a href="javascript:;" class="btn btn-success btn-xs ">已审核</a>';
                                    if(value == -1)
                                        return '<a href="project_2020_bak/edit/ids/'+row.id+'" class="btn btn-warning btn-xs btn-addtabs" data-icon="fa fa-pencil" data-title="编辑">待提交</a>';
                                }
                            }
                        ];
                    }
                }


                if(show_edit  )
                {
                    btn_detail = {field: 'operate', title: __('Operate'), align:'left',with:'120px',table: table, events: Table.api.events.operate,
                        buttons: [
                            {
                                name: 'edit',
                                icon: 'fa fa-pencil',
                                text: '编辑',
                                title: __('Edit'),
                                extend: 'data-toggle="tooltip"',
                                classname: 'btn btn-xs btn-success btn-addtabs btn-modi',
                                extend: 'data-icon="fa fa-pencil" data-toggle="tooltip" data-area=\'["100%","100%"]\'',
                                url: 'project_2020_bak/edit',
                                visible:false,
                                visible:function(row) {
                                    var idx = -1;
                                    if(row.chargedep_ids)
                                    {
                                        var chargedep_ids_arr = row.chargedep_ids.split(',');

                                        idx= chargedep_ids_arr.findIndex(function(item){
                                            return parseInt(item) == parseInt(Config.chargedep_id);
                                        })
                                    }


                                    if(Config.isSuperAdmin || idx!=-1)
                                        return true;
                                    else
                                        return false;
                                }
                            },
                            // {
                            //     name: 'detail',
                            //     icon: 'fa fa-info',
                            //     title: __('详情'),
                            //     text: '详情',
                            //     url: 'project/detail',
                            //     extend: 'data-toggle="tooltip"',
                            //     classname: 'btn btn-xs btn-info btn-addtabs'
                            // }
                        ],
                        formatter: Table.api.formatter.buttons

                    };
                }
                else
                {
                    btn_detail = {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
                            buttons: [{
                                   name: 'detail',
                                    icon: 'fa fa-info',
                                    text: '详情',
                                    title: __('详情'),
                                    url: 'project_2020_bak/detail',
                                    extend: 'data-toggle="tooltip" data-area=\'["100%","100%"]\'',
                                    classname: 'btn btn-xs btn-info btn-addtabs'
                            }],
                            formatter: Table.api.formatter.buttons
                        };

                }
                operate_columns.push(btn_detail)
                // if(btn_type == 0 || btn_type == 2) {
                //     var btn_operator ={
                //         field: 'check',
                //         width: "120px",
                //         title: __('审核'),
                //         table: table,
                //         events: Table.api.events.operate,
                //         visible: Config.isSuperAdmin ? true:false,
                //         buttons: [

                //             {
                //                 name: 'check',
                //                 title: '审核',
                //                 text: '审核',
                //                 title: __('审核'),
                //                 classname: 'btn btn-xs btn-warning  btn-magic btn-addtabs',
                //                 icon: 'fa fa-folder-o',
                //                 url: 'project/checkedit',
                //             }
                //         ],
                //         formatter: function (value, row, index) {
                //             console.log(Config.isSuperAdmin)
                //             if(Config.isSuperAdmin){
                //                 return Table.api.formatter.buttons.call(this, value, row, index);
                //             }
                //             return '';
                //         }
                //     };
                //     operate_columns.push(btn_operator)
                // }
                // if(Config.isSuperAdmin)
                //     common_columns.push({field: 'memo', title: __('备注'),operate:'like',width:'80px'});

                common_columns.push({field: 'name', title: __('Name'),operate:'like',width:'120px'
                        // cellStyle:function (value, row, index) {
                        //     return {
                        //         css: {
                        //             "min-width": "100px",
                        //             "white-space": "nowrap",
                        //             "text-overflow": "ellipsis",
                        //             "overflow": "hidden",
                        //             "max-width": "400px"
                        //         }
                        //     }
                        // }

                });
                common_columns.push({field: 'chargedep_names', halign:'center',title: __('提报部门'),width:'80px',operate:false,
                    formatter:Table.api.formatter.delimiter
                });



                common_columns.push({field: 'chargedep_ids', title: __('提报部门'),visible:false,
                            operate:'FIND_IN_SET',
                            searchList: $.getJSON("selectlist/index/tablename/chargedep")
                            // extend:"data-source='chargedep/index'"
                });

                // common_columns.push({field: 'progress_status_id', title: __('项目状态'),
                //     visible:false,
                //     searchList: $.getJSON("selectlist/progress")
                // });
                // common_columns.push({field: 'progress_status_name', title: __('progress_status_name'),
                //     operate:false,
                // });

                common_columns.push({field: 'five_industry_id', title: __('Five_industry_id'),
                    width:'120px',
                    visible:false,
                    searchList: $.getJSON("selectlist/index/tablename/five_industry")
                    // extend:"data-source='five_industry/index'"
                });
                // common_columns.push({field: 'five_industry_name', title: __('Five_industry_id'),
                //     operate:false,
                // });
                common_columns.push({field: 'industry_category_ids', title: __('Industry_category_ids'),
                    visible:false,
                    operate:'FIND_IN_SET',
                    searchList: $.getJSON("selectlist/index/tablename/industry_category")
                    // extend:"data-source='industry_category/index'"
                });
                common_columns.push({field: 'industry_category_names', width:'80px',title: __('industry_category_ids'),
                    operate:false,
                    formatter:function(value,row,index){
                        if(value)
                        {
                            str = value.replace(/都不是/g,"");
                            str = str.replace(/,/g,"/");
                            str = str?'/'+str:str;
                            return row.five_industry_name + str;
                        }
                        else
                            return row.five_industry_name;

                    }
                });
                if(Config.library_id ==1) {
                    common_columns.push({field: 'progress_status_id', title: __('项目阶段'),
                        visible:false,
                        searchList: $.getJSON("selectlist/progress")
                    });
                    common_columns.push({field: 'progress_status_name', title: __('progress_status_name'),
                        width:'60px',
                        operate:false,
                    });
                }
                if(Config.library_id == 2 || Config.library_id == 6)
                {
                    common_columns.push({field: 'registered_capital', title: __('Registered_capital'),
                        width:'50px',
                        operate:'BETWEEN',
                        formatter:function(value,row,index) {
                            if(value == -100)
                                return '待定';
                            else if(value > 0)
                                return parseFloat(value);
                            else
                                return '';
                        }
                    });
                }

                common_columns.push({field: 'investment_total', title: __('Investment_total'),
                    width:'50px',
                    operate:'BETWEEN',
                    formatter:function(value,row,index) {
                        if(value == -100)
                            return '待定';
                        else if(value > 0)
                            return parseFloat(value);
                        else
                            return '';
                    }
                });
                common_columns.push({field: 'domestic_capital', title: __('Domestic_capital'),
                    width:'50px',
                    operate:'BETWEEN',
                    formatter:function(value,row,index) {
                        if(value == -100)
                            return '待定';
                        else if(value > 0)
                            return parseFloat(value);
                        else
                            return '';
                    }
                });
                common_columns.push({field: 'foreign_capital', title: __('Foreign_capital'),
                    width:'50px',
                    operate:'BETWEEN',
                    formatter:function(value,row,index) {
                        if(value == -100)
                            return '待定';
                        else if(value > 0)
                            return parseFloat(value);
                        else
                            return '';
                    }
                });
                // common_columns.push({field: 'asset_type_id', title: __('Asset_type'),
                //     searchList: {"1": __('内资'), "0": __('外资')},
                //     formatter:function(value,row,index)
                //     {
                //         if(value == 1)
                //             return '内资';
                //         else if(value == 2)
                //             return '外资';
                //         else
                //             return '';
                //     }
                // });

                if(Config.library_id == 1)
                {

                    // common_columns.push({field: 'progression',width:"120px", title: __('Progression'),operate:false});
                    // common_columns.push({field: 'problem', width:"40px",title: __('Problem'),operate:false});
                    // common_columns.push({field: 'next_measure',width:"120px", title: __('next_measure'),operate:false});
                    common_columns.push({field: 'access_time', title: __('access_time'),
                        addclass:'datetimerange',
                        visible:false
                    });
                    common_columns.push({field: 'access_time_desc', title: __('access_time'),
                        width:'80px',
                        operate:false,
                    });
                    common_columns.push({field: 'sign_time', title: __('sign_time'),
                        addclass:'datetimerange',
                        visible:false
                    });
                    common_columns.push({field: 'sign_time_desc', title: __('sign_time'),
                        width:'80px',
                        operate:false,
                    });

                }
                if(Config.library_id == 2 || Config.library_id == 6)
                {

                    common_columns.push({field: 'framework_agreement_time_desc', title: __('framework_agreement_time_desc'),
                        width:'80px',
                        operate:false
                    });
                    common_columns.push({field: 'framework_agreement_time', title: __('framework_agreement_time_desc'),
                        visible:false,
                        addclass:'datetimerange',
                        operate: 'RANGE',
                        datetimeFormat:"YYYY-MM-DD",
                    });
                    common_columns.push({field: 'invesment_agreement_time_desc',
                        width:'80px',
                        title: __('invesment_agreement_time_desc'),
                        operate:false
                    });
                    common_columns.push({field: 'invesment_agreement_time', title: __('invesment_agreement_time'),
                        visible:false,
                        addclass:'datetimerange',
                        operate: 'RANGE',
                        datetimeFormat:"YYYY-MM",
                    });
                    common_columns.push({field: 'register_time', title: __('register_time'),
                        addclass:'datetimerange',
                        datetimeFormat:"YYYY-MM",
                        operate: 'RANGE',
                        formatter: Table.api.formatter.datetime,
                        visible:false
                    });
                    common_columns.push({field: 'register_time_desc', title: __('register_time'),
                        width:'80px',
                        operate:false
                    });
                    common_columns.push({field: 'land_time', title: __('land_time'),
                        addclass:'datetimerange',
                        datetimeFormat:"YYYY-MM",
                        operate: 'RANGE',
                        formatter: Table.api.formatter.datetime,
                        visible:false
                    });
                    // 2020年签约新征地项目
                    if(Config.library_id == 6)
                    {
                        common_columns.push({field: 'land_time_desc', title: __('land_time'),
                            width:'80px',
                            operate:false,
                            // 该列标红
                            cellStyle: function (value, row, index) {
                                var style = {};
                                //当前列，单元格显示红色
                                if(row.land_time>0&&row.newland_status==0)
                                {
                                    var timestamp = Date.parse(new Date());//当前时间
                                    var end=row.land_time*1000;//拿地时间
                                    var utc=end-timestamp;
                                    var day = utc/(24*60*60*1000);// 天
                                    console.log(day);
                                    console.log(row.land_time);
                                    if(day<10) //10天以内背景标黄
                                        style={css:{'background-color':'yellow'}};
                                    if(day<0) //10天以内背景标黄
                                        style={css:{'background-color':'red','color':"white"}};
                                }
                                return style;
                            }
                        });
                    }else{
                        //签约库
                        common_columns.push({field: 'land_time_desc', title: __('land_time'),
                            width:'80px',
                            operate:false,
                        });
                    }

                    common_columns.push({field: 'start_construction_time', title: __('start_construction_time'),
                        addclass:'datetimerange',
                        operate: 'RANGE',
                        datetimeFormat:"YYYY-MM",
                        formatter: Table.api.formatter.datetime,
                        visible:false
                    });
                    common_columns.push({field: 'start_construction_time_desc', title: __('start_construction_time'),
                        width:'80px',
                        operate:false
                    });

                    // 是否准入例会
                    common_columns.push({field: 'is_access', title: __('是否准入例会'),width:'80px',searchList:{"是":"是","否":"否","无":"无须上准入例会项目"}});
                    common_columns.push({field: 'access_time', title: __('准入例会时间'),
                        visible:false,
                        addclass:'datetimerange',
                        operate: 'RANGE',
                        datetimeFormat:"YYYY-MM",
                        width:'80px',
                        formatter: Table.api.formatter.datetime,
                    });

                }

                common_columns.push({field: 'investment_name',title: __('investment_name'),width:'100px',operate:'like',
                    formatter:Table.api.formatter.delimiter
                });
                common_columns.push({field: 'investment_area', title: __('investment_area'),operate:'like',
                    width:'60px',
                    formatter:Table.api.formatter.delimiter
                });
                common_columns.push({field: 'investment_attribute_ids', title: __('Investment_attribute_ids'),
                    visible:false,
                    operate:'FIND_IN_SET',
                    searchList: $.getJSON("selectlist/index/tablename/investor_attribute")
                });
                common_columns.push({field: 'investment_attribute_names', title: __('Investment_attribute_ids'),
                    width:'80px',
                    operate:'like',
                    operate:false,formatter:Table.api.formatter.delimiter
                });

                common_columns.push({field: 'carrier_id', title: __('Carrier_id'),
                    visible:false,
                    // addClass: "selectpage",
                    // data:'data-source="carrier/index"'+ 'data-field="name"',
                    // extend: "data-source='carrier/index' data-field='name'",
                    // data-source="*/selectpage
                    operate:'FIND_IN_SET',
                    searchList: $.getJSON("selectlist/index/tablename/carrier")
                });
                common_columns.push({field: 'carrier_name', title: __('Carrier_id'),
                    width:'80px',
                    operate:'like',
                    operate:false,formatter:Table.api.formatter.delimiter
                });


                if(Config.library_id == 1)
                {
                    common_columns.push({field: 'planned_street_ids', title: __('planned_street_ids'),
                        visible:false,
                        operate:'FIND_IN_SET',
                        searchList: $.getJSON("selectlist/street")
                        // extend:"data-source='industry_category/index'"
                    });
                    common_columns.push({field: 'planned_street_names', title: __('planned_street_names'),
                        width:'80px',
                        operate:false,
                        formatter:Table.api.formatter.delimiter
                    });
                }
                if(Config.library_id == 2 || Config.library_id == 6)
                {
                    common_columns.push({field: 'settle_street_ids', title: __('Settle_street_ids'),
                        visible:false,
                        operate:'FIND_IN_SET',
                        searchList: $.getJSON("selectlist/street")
                        // extend:"data-source='industry_category/index'"
                    });
                    common_columns.push({field: 'settle_street_names', title: __('Settle_street_ids'),
                        width:'80px',
                        operate:false,
                    });

                }
                common_columns.push({field: 'project_source_ids', title: __('project_source_ids'),
                    visible:false,
                    operate:'FIND_IN_SET',
                    searchList: $.getJSON("selectlist/index/tablename/activity")
                });
                common_columns.push({field: 'project_source_names', title: __('project_source_ids'),
                    width:'80px',
                    operate:false,
                    formatter:Table.api.formatter.delimiter
                });
                common_columns.push({field: 'summary', halign:'center', title: __('Summary'),width:"100px",operate:false,
                    formatter: function(value,row,index) {
                        var str = value?value:'';
                        return '<div style="width:100px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">'+str+'</div>';
                    }
                });
                common_columns.push({field: 'city_district_contact', halign:'center', title: __('City_district_contact'),width:"5%",operate:false});

                if(show_memo)
                {
                    if(!Config.isBuDi && Config.library_id !=6){
                        common_columns.push({field: 'required_text', title: __('必填项'),width:"150px",align:'left',
                            formatter:Table.api.formatter.br,
                            operate:false
                        });

                        common_columns.push({field: 'reject_memo', title: __('驳回原因'),width:"150px",align:'left',
                            operate:false,
                            formatter: function(value,row,index) {
                                var str = value?value:'';
                                if(Config.isSuperAdmin)
                                    return '<span style="color:red">'+str+'</span>';
                                else
                                    return str;

                            }
                        });
                    }


                    if(Config.isSuperAdmin)
                    {
                        common_columns.push({field: 'convert_memo', title: __('备注'),width:"100px",operate:false});
                        common_columns.push({field: 'memo', title: __('备注'),width:"100px",operate:false,

                            editable:true
                        });

                        common_columns.push({field: 'is_visible_sz', title: __('双招可见'),width:"80px",operate:false,

                            formatter: Table.api.formatter.toggle
                        });
                    }
                }



                // var field_columns = pre_columns.concat(common_columns,operate_columns,check_columns);
                var field_columns = pre_columns.concat(common_columns,check_columns);
                return [field_columns];
            },
            check_columns: function(table){
                 var field_columns =
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        // {field: 'pno', title: __('Pno')},
                        // {field: 'sort', title: __('Sort')},
                        {field: 'name', title: __('Name')},
                        {field: 'chargedep_names', title: __('提报部门')},
                        {
                            field: 'check',
                            width: "120px",
                            title: __('审核'),
                            table: table,
                            events: Table.api.events.operate,
                            visible: Config.isSuperAdmin ? true:false,
                            buttons: [
                                {
                                    name: 'check',
                                    text: '审核',
                                    title: __('审核'),
                                    classname: 'btn btn-xs btn-warning  btn-magic btn-addtabs',
                                    icon: 'fa fa-folder-o',
                                    url: 'project_2020_bak/checkedit',
                                }
                            ],
                            formatter: function (value, row, index) {
                                // console.log(Config.isSuperAdmin)
                                if(Config.isSuperAdmin){
                                    return Table.api.formatter.buttons.call(this, value, row, index);
                                }
                                return '';
                            }
                        }

                    ];
                    return [field_columns];
            },
            buttons:function(row) {

                console.log(row);
                return [{
                   name: 'detail',
                    icon: 'fa fa-info',
                    title: __('详情'),
                    url: 'project_2020_bak/detail',
                    extend: 'data-toggle="tooltip" data-area=\'["100%","100%"]\'',
                    classname: 'btn btn-xs btn-info btn-addtabs'
                }];
            },


        }
    };
    return Controller;
});